<#import "/layout/mainLayout.html" as mainLayout />

<#macro mainheading>
    <!--<link href="/plugins/ALTE/bootstrap/css/form-showcase.css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/bootstrap/css/bootstrap-responsive.css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/bootstrap/css/bootstrap-overrides.css" type="text/css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/plugins/morris/morris.css" rel="stylesheet"/>-->
</#macro>
<#assign mainheading = mainheading in mainLayout />

<#macro maincontent>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="col-xs-12">
                        <div class="box-primary">
                            <!-- form start -->
                            <form id="filmform"
                                  class="form-horizontal"
                                  method="post"
                                  enctype="multipart/form-data">
                                <div class=""
                                     box-body
                                     id="box-body">

                                    <div class="form-group">
                                        <label for="film_name"
                                               class="col-sm-2 control-label">电影名称
                                        </label>
                                        <div class="col-sm-4">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_name"
                                                   id="film_name"
                                                   placeholder="电影名称" maxlength="20" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="film_keyword"
                                               class="col-sm-2 control-label">电影看点
                                        </label>
                                        <div class="col-xs-5">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_keyword"
                                                   placeholder="电影看点"
                                                   id="film_keyword" maxlength="50">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="film_impression"
                                               class="col-sm-2 control-label">观众印象
                                        </label>
                                        <div class="col-xs-5">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_impression"
                                                   placeholder="观众印象"
                                                   id="film_impression" maxlength="300" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="film_price"
                                               class="col-sm-2 control-label">电影价格
                                        </label>
                                        <div class="col-xs-3">
                                            <select class="form-control"
                                                    id="film_price"
                                                    name="film_price">

                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">

                                        <label for="film_year"
                                               class="col-sm-2 control-label">年份
                                        </label>
                                        <div class="col-xs-3">
                                            <select class="form-control"
                                                    id="film_year"
                                                    name="film_year">
                                                <option value="-1">--年份--</option>
                                                <option value="2017">2017</option>
                                                <option value="2016">2016</option>
                                                <option value="2015">2015</option>
                                                <option value="2014">2014</option>
                                                <option value="2013">2013</option>
                                                <option value="2012">2012</option>
                                                <option value="2011">2011</option>
                                                <option value="2010">更早</option>
                                            </select>
                                        </div>
                                        <label for="film_country"
                                               class="col-sm-2 control-label">国家
                                        </label>
                                        <div class="col-xs-4">
                                            <select class="form-control"
                                                    id="film_country"
                                                    name="film_country">

                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="film_director"
                                               class="col-sm-2 control-label">导演
                                        </label>
                                        <div class="col-xs-3">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_director"
                                                   placeholder="导演"
                                                   id="film_director" maxlength="20" >
                                        </div>
                                        <label for="film_performer"
                                               class="col-sm-2 control-label">主演
                                        </label>
                                        <div class="col-xs-3">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_performer"
                                                   placeholder="主演"
                                                   id="film_performer" maxlength="100">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="film_showdate"
                                               class="col-sm-2 control-label">上映时间
                                        </label>
                                        <div class="col-xs-3">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_showdate"
                                                   placeholder="上映时间"
                                                   id="film_showdate">
                                        </div>
                                    </div>
                                    <div class="form-group">

                                        <label for="film_showdate"
                                               class="col-sm-2 control-label">豆瓣得分
                                        </label>
                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="filmscore_douban"
                                                   placeholder="豆瓣得分"
                                                   value='0'
                                                   id="filmscore_douban">
                                        </div>
                                        <label for="film_showdate"
                                               class="col-xs-2 control-label">烂番茄得分
                                        </label>
                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="filmscore_lanfanqie"
                                                   placeholder="烂番茄得分"
                                                   value='0'
                                                   id="filmscore_lanfanqie">
                                        </div>

                                        <label for="film_showdate"
                                               class="col-xs-2 control-label">imdb得分
                                        </label>
                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="filmscore_imdb"
                                                   placeholder="imdb得分"
                                                   value='0'
                                                   id="filmscore_imdb">
                                        </div>

                                    </div>

                                    <div class="form-group ">
                                        <label for="film_makelookct"
                                               class="col-xs-2 control-label">点击量:
                                        </label>
                                        <div class="col-xs-2 ">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_makelookct"
                                                   placeholder="imdb得分"
                                                   value='0'
                                                   id="film_makelookct">
                                        </div>
                                        <label for="film_makegoodct"
                                               class="col-xs-2 control-label">点赞量:
                                        </label>
                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_makegoodct"
                                                   placeholder="imdb得分"
                                                   value='0'
                                                   id="film_makegoodct">
                                        </div>
                                        <label for="film_makecollectct"
                                               class="col-xs-2 control-label">收藏量:
                                        </label>

                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_makecollectct"
                                                   placeholder="imdb得分"
                                                   value='0'
                                                   id="film_makecollectct">
                                        </div>
                                    </div>

                                    <div class="form-group ">
                                        <label for="film_makesharect"
                                               class="col-xs-2 control-label">分享量:
                                        </label>
                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_makesharect"
                                                   placeholder="imdb得分"
                                                   value='0'
                                                   id="film_makesharect">
                                        </div>
                                        <label for="film_makeplayct"
                                               class="col-xs-2 control-label">点赞量:
                                        </label>
                                        <div class="col-xs-2">
                                            <input type="text"
                                                   class="form-control"
                                                   name="film_makeplayct"
                                                   placeholder="imdb得分"
                                                   value='0'
                                                   id="film_makeplayct">
                                        </div>
                                    </div>
                                    <div class="form-group"
                                         id="div_filmtype">

                                    </div>

                                    <div class="form-group">
                                        <input type="hidden"
                                               id="film_filmtype"
                                               name="film_filmtype">
                                        <label for="film_desc"
                                               class="col-sm-2 control-label">
                                            简介</label>
                                        <div class="col-sm-4">
                                            <textarea class="form-control"
                                                      name="film_desc"
                                                      rows="3"
                                                      placeholder="简介 ..."
                                                      id="film_desc" maxlength="1000"></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-2">
                                        </div>
                                        <div class="col-sm-2">
                                            <img id="ImgPr"
                                                 class="ImgPr"
                                                 width="120"
                                                 height="120"/>
                                        </div>
                                        <label class="col-sm-2 control-label"
                                               for="film_pic">选择图片
                                        </label>
                                        <div class="col-sm-4">
                                            <input type="file"
                                                   id="film_pic"
                                                   name="film_pic">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-2">
                                        </div>
                                        <div class="col-sm-2">
                                            <img id="ImgPr2"
                                                 class="ImgPr"
                                                 width="120"
                                                 height="120"/>
                                        </div>
                                        <label class="col-sm-2 control-label"
                                               for="film_pic2">选择小图片
                                        </label>
                                        <div class="col-sm-4">
                                            <input type="file"
                                                   id="film_pic2"
                                                   name="film_pic2">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-2">
                                        </div>
                                        <div class="col-sm-2">
                                            <img id="ImgPr1"
                                                 class="ImgPr"
                                                 width="120"
                                                 height="120"/>
                                        </div>
                                        <label class="col-sm-2 control-label"
                                               for="film_pic1">选择宽度图片
                                        </label>
                                        <div class="col-sm-4">
                                            <input type="file"
                                                   id="film_pic1"
                                                   name="film_pic1">
                                        </div>
                                    </div>
                                    <!--<div class="form-group">-->
                                        <!--<label class="col-sm-2 control-label">选择剧照-->
                                        <!--</label>-->
                                        <!--<div class="col-sm-4 pull-right">-->
                                            <!--<input type="file"-->
                                                   <!--name="film_stage">-->
                                        <!--</div>-->
                                        <!--<div class="col-sm-4 pull-right">-->
                                            <!--<input type="file"-->
                                                   <!--name="film_stage">-->
                                        <!--</div>-->
                                    <!--</div>-->
                                </div><!-- /.box-body -->
                                <div class="box-footer">
                                    <button type="button"
                                            class="btn btn-info pull-right"
                                            onclick="addFilm()">添加电影
                                    </button>
                                </div><!-- /.box-footer -->
                            </form>
                        </div>
                    </div>
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </section>

</#macro>
<#assign maincontent = maincontent in mainLayout />

<#macro mainfooter>
    <script src="/js/mortise/contrydata.js"></script>
    <script src="/js/jquery/jquery.form.js"></script>

    <script type="text/javascript">
        $(function () {
            $("#film_pic").uploadPreview({Img: "ImgPr", Width: 120, Height: 120});
            $("#film_pic1").uploadPreview({Img: "ImgPr1", Width: 120, Height: 120});
            $("#film_pic2").uploadPreview({Img: "ImgPr2", Width: 120, Height: 120});
        });
        //加载数据
        function loadData() {
            fillCountrySelect('film_country');
            fillDivVideoType('div_filmtype');
            FillPricetagSelect('film_price');

        }
        loadData();
        function addFilm() {
            var filmtypeidlist = '';
            $.each($('input[id^=input_check]'), function (index, item) {
                if (item.checked == true) {
                    filmtypeidlist += '1';
                }
                else {
                    filmtypeidlist += '0';
                }
            });
            $('#film_filmtype').val(filmtypeidlist);
            if (!$('#film_name').val()) {
                dialog({
                    title: '提示',
                    content: '请输入电影名称！',
                    cancel: false,
                    ok: function () {
                    }
                }).width(320).showModal();
                return;
            }

            if($('#filmscore_douban').val()==""){
                $('#filmscore_douban').val(0);
            }
            if($('#filmscore_lanfanqie').val()==""){
                $('#filmscore_lanfanqie').val(0);
            }
            if($('#filmscore_imdb').val()==""){
                $('#filmscore_imdb').val(0);
            }


            var options = {
                url: '/api/video/addfilm',
                type: 'post',
                success: function (data) {
                    if (data) {
                        if (data.code == 'OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！是否添加影片来源',
                                cancel: true,
                                okValue:'添加来源',
                                ok: function () {
                                    window.location.href='/page/video/filmupdate?fid='+data.result+'&isaddsource=true'
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#filmform").ajaxSubmit(options);
        }
    </script>
</#macro>
<#assign mainfooter = mainfooter in mainLayout />
<@mainLayout.page title="电影管理"/>